package com.example.test.nettytest.netty;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class NettyStart implements CommandLineRunner {

    private static Logger log = LoggerFactory.getLogger(NettyStart.class);

    @Autowired
    HeartBeatsClient heartBeatsClient;


    /**
     * springboot启动完成后会执行这个方法
     * */
    @Override
    public void run(String... args) throws Exception {
        log.info("客户端启动netty---------");
        heartBeatsClient.connect(8888,"127.0.0.1");
    }
}
